﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TelligentCommunity
{
    public class NenaRestUrls
    {

        //public static string UsersUrl = Connections.TcNenaUrl + "/api.ashx/v2/users.xml";

        /// <summary>
        /// http://telligent.com/community/developers/w/wiki/get-all-groups.aspx
        /// </summary>
        /// <returns></returns>
        public string GetGroups()
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/groups.xml";
        }

        /// <summary>
        /// Gets the groups a user belongs too
        /// http://telligent.com/community/developers/w/wiki/get-user-s-groups.aspx
        /// </summary>
        public string GetUserGroups(int UserId)
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/users/" + UserId + "/groups.xml";

        }

        /// <summary>
        /// Gets the Users that belong to a group
        /// </summary>
        /// <param name="enumAffiliate"></param>
        /// <returns></returns>
        public string GetGroupUsers(CommunityServer.Groups.NENAAffiliates enumAffiliate)
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/groups/{" + Convert.ToInt32(enumAffiliate) + "}/members/users.xml";
        }
        /// <summary>
        /// add - http://telligent.com/community/developers/w/wiki/add-user-to-a-role.aspx
        /// get - http://telligent.com/community/developers/w/wiki/get-user-s-roles.aspx
        /// </summary>
        /// <example> var postUrl = "http://mysite.com/api.ashx/v2/roles/user/2800.xml"; // or .json
        /// </example>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public string UserRoles(int UserId)
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/roles/user/" + UserId + ".xml";
        }

        public string GetUser(int UserId)
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/user/" + UserId + ".xml";
        }

        /// <summary>
        /// http://telligent.com/community/developers/w/wiki/get-users.aspx
        /// </summary>
        /// <returns></returns>
        public string GetUsers()
        {
            return Connections.TcNenaUrl + "/api.ashx/v2/users.xml";
        }

        public string RemoveUserFromRole(int UserId, int roleId)
        {

            //"http://mysite.com/api.ashx/v2/roles/{roleid}/user/2100.xml";
            return Connections.TcNenaUrl + "/api.ashx/v2/roles/" + roleId.ToString() + "/user/" + UserId + ".xml";
        }

    }
}
